﻿#ifndef HSPLAYER_H
#define HSPLAYER_H

#include <QLabel>
#include "config/config.h"
#include "hsffmpeg.h"
#include <QMouseEvent>
#include <QPushButton>
class HSPlayer : public QLabel
{
    Q_OBJECT

public:
    HSPlayer();
    ~HSPlayer();
protected:
    void mousePressEvent(QMouseEvent* event);
public:

    void   HSPlayer_Start();
    void   HSPlayer_Set_ChannelText(QString ch);
    void   HSPlayer_Local_LoadFile(QString videoPath);

    bool   HSPlayer_Network_LoadIPC(QString videoPath);
    void   HSPlayer_Resize(int w,int h);///resize the window and resize sdl2 window
    void   HSPlayer_Move(int x,int y);
    void   HSPlayer_Show();///guarantee the QLabel is on the top of the video

signals:
    void   HS_PlayControl_PlayStatusChange(int status);/// play  stop pause the record
    void   HS_PlayControl_PlaySpeedChange(int frame,int num,int dec);///speedUp Play && slowPlay the Record
private:
    HSPlayer_WindowRect      HSPlayer_Get_WindowRect(){return this->HS_PlayWindowRect;}
private:
    QString                  HS_StreamURL;
    bool                     HS_IsFullScreen=false;
    HSPlayer_WindowRect      HS_PlayWindowRect;
    HSFFmpeg*                HS_Player;


    HSPlayer_PlayStatus      HS_PlayStatus=HSPlayer_Play;
    int                      HS_PlaySpeed_num=16;
    int                      HS_PlaySpeed_Dec=16;///playSpeed = HS_PlaySpeed_num/HS_PlaySpeed_Dec

    bool                     HS_SDL2_HAS_Init=false;
    bool                     HS_FFMPEG_HAS_Init=false;
};

#endif // HSPLAYER_H
